package com.chengxiaoxiao.ai_demo.tool;

import cn.hutool.core.date.DateUtil;
import com.chengxiaoxiao.ai_demo.service.IndexInfoService;
import com.chengxiaoxiao.ai_demo.vo.vo.IndexTreeVo;
import dev.langchain4j.agent.tool.P;
import io.micrometer.observation.annotation.Observed;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.List;

/**
 * 指标信息工具
 *
 * @Description:
 * @Author Cheng Xiaoxiao
 * @Date: 2025/3/7 14:53
 */
@Component
@RequiredArgsConstructor
public class IndexInfoTool {

    final IndexInfoService indexInfoService;

    //    @Tool("根据指标id获取指标信息")
    @Observed
    public List<IndexTreeVo> getById(@P("指标id") String indexId) {
        return indexInfoService.getIndexInfo(indexId);
    }

    /**
     * 获取当前时间
     *
     * @return 时间字符串
     */
//    @Tool("获取当前时间")
    @Observed
    String currentTime() {
        return DateUtil.format(LocalDateTime.from(LocalTime.now()), "yyyy-MM-dd HH:mm:ss");
    }
}
